package selcoursesys.action;

import com.opensymphony.xwork2.ActionSupport;
import org.apache.struts2.ServletActionContext;
import selcoursesys.service.TeacherService;
import selcoursesys.service.impl.TeacherServiceImpl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

/**
 * Created by Lpbdz on 2017/4/11.
 */
public class TeacherAction extends ActionSupport {
    private HttpServletRequest request;
    private HttpSession session;
    public String showStuSelInfo() throws Exception{
        /**
         * GET:课程名,学分,已选人数,可选人数,上课时间,上课地点,选课学生姓名,学号,班级,学院
         * By: tid
         * getCourseInfo(),getStudentInfo()
         **/
        HttpServletRequest request = ServletActionContext.getRequest();
        String teaid=request.getParameter("teaid");
        //System.out.println("教师号"+teaid);
        TeacherService teacherService=new TeacherServiceImpl();
        if(teacherService.getInsInfo(teaid)==true){
            //System.out.println("教师号111"+teaid);
            request=ServletActionContext.getRequest();
            session=request.getSession();
            session.setAttribute("stuid",teaid);
            return "go_to_tea";
        }
        return ERROR;
    }
}
